package com.example.ai.agent;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.extern.slf4j.Slf4j;

/**
 * ReAct
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Slf4j
public abstract class ReActAgent extends BaseAgent{

    public abstract boolean think();

    public abstract String act();


    public String step(){
        try {
            if (!think()) {
                return "思考完成";
            }
            return act();
        } catch (Exception e) {
            log.error("agent error", e);
            return "思考失败"+e.getMessage();
        }
    }
}
